package com.qf.hospital.service.impl;

import com.qf.hospital.entity.RegisterExample;
import com.qf.hospital.mapper.RegisterMapper;
import com.qf.hospital.service.RegisterService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ASUS
 * @version V1.0
 * @Project hospital
 * @Package com.qf.hospital.service.impl
 * @Date 2021/10/19 19:29
 */
@Service
public class RegisterServiceImpl implements RegisterService {

    Logger log = LoggerFactory.getLogger(RegisterServiceImpl.class);

    @Autowired
    private RegisterMapper registerMapper;

    /**
     * 住院总人数
     * @return
     */
    @Override
    public Integer zhuyuanTotal() {
        RegisterExample registerExample = new RegisterExample();
        RegisterExample.Criteria criteria = registerExample.createCriteria();
        criteria.andStateNotEqualTo(0);
        long totalSize = registerMapper.countByExample(registerExample);
        return Integer.valueOf(totalSize+"");
    }

    /**
     * 今日住院总人数
     * @return
     */
    @Override
    public Integer currentZhuYuan() {
        return registerMapper.findRegisterCountByCurrent();
    }
}
